<?php

// App::membersOnly();

$oReq = &App::getRequest();

$iVidId = $oReq->get('vidid');
$iVidId = base64_decode($iVidId);
$iVidId = explode(md5(App::getParam('Mod_Video.md5')), $iVidId);

if ( !isset($iVidId[0]) )
{
	exit('Invalid Video Hash!');
}

$iVidId = $iVidId[0];

$seekat = 0;

$sReelPath = App::getParam('video.path') . str_replace("_", ".", $iVidId);
if (!file_exists($sReelPath))
{
	exit('Invalid video ID!');
}

@ob_clean();

header("Content-Type: video/x-flv");

if($seekat != 0)
{
	print("FLV");
	print(pack('C', 1 ));
	print(pack('C', 1 ));
	print(pack('N', 9 ));
	print(pack('N', 9 ));
}

$fh = fopen($sReelPath, "rb");
fseek($fh, $seekat);
while (!feof($fh))
{
	print(fread($fh, filesize($sReelPath)));
}
fclose($fh);
exit;
?>